import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/wb";

// 查询考试列表
export function listExams(data) {
  return request({
    url: '/exams/list',
    method: 'post',
    data
  })
}

// 查询考试详细
export function getExams(id) {
  return request({
    url: '/exams/' + parseStrEmpty(id),
    method: 'get'
  })
}

// 新增考试
export function addExams(data) {
  return request({
    url: '/exams/add',
    method: 'post',
    data
  })
}

// 修改考试
export function updateExams(data) {
  return request({
    url: '/exams/update',
    method: 'post',
    data
  })
}

// 删除考试（支持批量）
export function delExams(idOrIds) {
  const ids = Array.isArray(idOrIds) ? idOrIds : [idOrIds]
  return request({
    url: '/exams/deleteAll',
    method: 'delete',
    data: { ids }
  })
}

